package top.zerozoo.learn.grade.service.impl;

import top.zerozoo.learn.grade.dao.MajorDao;
import top.zerozoo.learn.grade.entity.Major;
import top.zerozoo.learn.grade.factory.DaoFactory;
import top.zerozoo.learn.grade.service.MajorService;

import java.util.List;

public class MajorServiceImpl implements MajorService {

    private final MajorDao majorDao = DaoFactory.get(MajorDao.class);

    @Override
    public List<Major> findAll() {
        return majorDao.findAll();
    }

    @Override
    public Major findById(int id) {
        if(id <= 0){
            return null;
        }
        return majorDao.findById(id);
    }
}
